package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PatrolRouteRecordMapper;
import com.ruoyi.system.domain.PatrolRouteRecord;
import com.ruoyi.system.service.IPatrolRouteRecordService;

/**
 * 巡线记录Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-17
 */
@Service
public class PatrolRouteRecordServiceImpl implements IPatrolRouteRecordService
{
    @Autowired
    private PatrolRouteRecordMapper patrolRouteRecordMapper;

    /**
     * 查询巡线记录
     *
     * @param id 巡线记录主键
     * @return 巡线记录
     */
    @DataSource(DataSourceType.SLAVE)
    @Override
    public PatrolRouteRecord selectPatrolRouteRecordById(String id)
    {
        return patrolRouteRecordMapper.selectPatrolRouteRecordById(id);
    }

    /**
     * 查询巡线记录列表
     *
     * @param patrolRouteRecord 巡线记录
     * @return 巡线记录
     */
    @DataSource(DataSourceType.SLAVE)
    @Override
    public List<PatrolRouteRecord> selectPatrolRouteRecordList(PatrolRouteRecord patrolRouteRecord)
    {
        return patrolRouteRecordMapper.selectPatrolRouteRecordList(patrolRouteRecord);
    }

    /**
     * 新增巡线记录
     *
     * @param patrolRouteRecord 巡线记录
     * @return 结果
     */
    @Override
    public int insertPatrolRouteRecord(PatrolRouteRecord patrolRouteRecord)
    {
        patrolRouteRecord.setCreateTime(DateUtils.getNowDate());
        return patrolRouteRecordMapper.insertPatrolRouteRecord(patrolRouteRecord);
    }

    /**
     * 修改巡线记录
     *
     * @param patrolRouteRecord 巡线记录
     * @return 结果
     */
    @Override
    public int updatePatrolRouteRecord(PatrolRouteRecord patrolRouteRecord)
    {
        patrolRouteRecord.setUpdateTime(DateUtils.getNowDate());
        return patrolRouteRecordMapper.updatePatrolRouteRecord(patrolRouteRecord);
    }

    /**
     * 批量删除巡线记录
     *
     * @param ids 需要删除的巡线记录主键
     * @return 结果
     */
    @Override
    public int deletePatrolRouteRecordByIds(Long[] ids)
    {
        return patrolRouteRecordMapper.deletePatrolRouteRecordByIds(ids);
    }

    /**
     * 删除巡线记录信息
     *
     * @param id 巡线记录主键
     * @return 结果
     */
    @Override
    public int deletePatrolRouteRecordById(Long id)
    {
        return patrolRouteRecordMapper.deletePatrolRouteRecordById(id);
    }
}
